package com.zjdiepu.www.diepu.api;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.annotation.Resource;

import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.diepu.www.client.proxy.partner.request.own.DiepuYwBusinessBuyersRequest;
import com.diepu.www.client.proxy.partner.request.own.DiepuYwBusinessLoanRequest;
import com.diepu.www.client.proxy.partner.request.own.DiepuYwOpenCardHzicbcRequest;
import com.diepu.www.client.proxy.partner.request.own.DiepuYwOpenCardHzicbcSubRequest;
import com.zjdiepu.www.proxy.biz.transfer.ITransferYwOpenCardHzicbcService;
import com.zjdiepu.www.response.BaseResponse;
import com.zjdiepu.www.response.BooleanResponse;
import com.zjdiepu.www.security.server.convert.MyJson;
import com.zjdiepu.www.security.server.core.Partners;
import com.zjdiepu.www.security.server.interceptor.PartnerProvider;

@MyJson
@RestController
@RequestMapping(value="OpenCardApplyController", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
@Api(tags = { "碟普请求" }, produces = "application/json;charset=UTF-8")
@PartnerProvider(partner = Partners.DIE_PU)
public class OpenCardApplyController {

	@Resource
	private ITransferYwOpenCardHzicbcService transferYwOpenCardHzicbcService;
	
	
	@ApiOperation(value = "开卡申请接收接口", response = BaseResponse.class, httpMethod = "POST")
	@RequestMapping("applyIcbcOpenCardInterface")
	public BaseResponse<BooleanResponse> applyIcbcOpenCardInterface(@Validated @RequestBody DiepuYwOpenCardHzicbcRequest diepuYwOpenCardHzicbcRequest) 
	{
		DiepuYwOpenCardHzicbcRequest diepuYwOpenCardHzicbcRequest1=new DiepuYwOpenCardHzicbcRequest();
		DiepuYwOpenCardHzicbcSubRequest diepuYwOpenCardHzicbcSubRequest=new DiepuYwOpenCardHzicbcSubRequest();
		DiepuYwBusinessLoanRequest diepuYwBusinessLoanRequest=new DiepuYwBusinessLoanRequest();
		DiepuYwBusinessBuyersRequest diepuYwBusinessBuyersRequest=new DiepuYwBusinessBuyersRequest();
		
		BeanUtils.copyProperties(diepuYwOpenCardHzicbcRequest, diepuYwOpenCardHzicbcRequest1);
		BeanUtils.copyProperties(diepuYwOpenCardHzicbcRequest, diepuYwOpenCardHzicbcSubRequest);
		BeanUtils.copyProperties(diepuYwOpenCardHzicbcRequest, diepuYwBusinessLoanRequest);
		BeanUtils.copyProperties(diepuYwOpenCardHzicbcRequest, diepuYwBusinessBuyersRequest);
		transferYwOpenCardHzicbcService.applyIcbcOpenCardInterface(diepuYwOpenCardHzicbcRequest1, diepuYwOpenCardHzicbcSubRequest, diepuYwBusinessLoanRequest,diepuYwBusinessBuyersRequest);
		return BaseResponse.successWithBoolean(true);
	}
}
